//************************************************************************
//     workmanager.h
//     2009 © Tom Booth
//
//     Definition for a work manager to dish out work to a group of 
//     threads. Now includes special work for special threads
//
//************************************************************************

#ifndef WORKMANAGER_HEADER
#define WORKMANAGER_HEADER

#include <pthread.h>

#include "../../headers/dferrors.h"


// thread condition to alert works that there are more jobs
pthread_cond_t wm_more_jobs;
pthread_mutex_t wm_more_jobs_mutex;

int wm_init_manager(void);
void wm_destroy_manager(void);

int wm_register_special(pthread_t thread);

int wm_add_item(void *payload, unsigned int is_special);

void* wm_get_item(void);

void wm_dump(void);

int wm_item_avaliable(void);


#endif